//package com.cxhc.framework.config;
//
//
//import com.cxhc.common.utils.spring.SpringUtils;
//import org.apache.ibatis.transaction.Transaction;
//import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.jdbc.datasource.DataSourceTransactionManager;
//import org.springframework.transaction.annotation.EnableTransactionManagement;
//import org.springframework.transaction.annotation.Isolation;
//import org.springframework.transaction.annotation.Propagation;
//import org.springframework.transaction.annotation.Transactional;
//
//import java.lang.annotation.Annotation;
//
//@Configuration
//@EnableTransactionManagement
//public class TransactionConfig {
//
//    public final static String MASTER_TX = "masterTx";
//
//    public final static String SLAVE_TX = "slaveTx";
//
//    public final static String SLAVE_OLD_TX = "slaveOldTx";
//
//    public final static String HC_DOC_TX = "hcDocTx";
//
//    @Bean(name=TransactionConfig.MASTER_TX)
//    public DataSourceTransactionManager transactionManager(){
//        return new DataSourceTransactionManager(SpringUtils.getBean("masterDataSource"));
//    }
//
//    @Bean(name=TransactionConfig.SLAVE_TX)
//    @ConditionalOnProperty(prefix = "spring.datasource.druid.slave", name = "enabled", havingValue = "true")
//    public DataSourceTransactionManager slaveTransaction(){
//        return new DataSourceTransactionManager(SpringUtils.getBean("slaveDataSource"));
//    }
//
//    @Bean(name=TransactionConfig.SLAVE_OLD_TX)
//    @ConditionalOnProperty(prefix = "spring.datasource.druid.slaveold", name = "enabled", havingValue = "true")
//    public DataSourceTransactionManager slaveOldTransaction(){
//        return new DataSourceTransactionManager(SpringUtils.getBean("slaveOldDataSource"));
//    }
//
//    @Bean(name=TransactionConfig.HC_DOC_TX)
//    @ConditionalOnProperty(prefix = "spring.datasource.druid.hcdocold", name = "enabled", havingValue = "true")
//    public DataSourceTransactionManager hcDocTransaction(){
//        return new DataSourceTransactionManager(SpringUtils.getBean("hcDocDataSource"));
//    }
//}
